package com.hikviison.rpq.quartz.quartz.task;

import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.concurrent.TimeUnit;

/**
 * @author renpeiqian
 * @date 2021/9/14 11:22
 * @since
 */
@Slf4j
public class TaskA  implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            log.info("执行了ScheduleTask类中的taskA方法");
            int i=1/0;
        } catch (Exception e) {
            JobExecutionException e2 = new JobExecutionException(e);
            // true 表示 Quartz 会自动取消所有与这个 job 有关的 trigger，从而避免再次运行 job
            e2.setUnscheduleAllTriggers(true);
            throw e2;

        }

    }
}
